<template>
  <div class="select">
    <label class="item-label">评级标准</label>
    <div class="list">
      <div class="item" v-for="(item, index) in items" :key="index">
        <div class="title">{{ formatter(item.name) }}标准</div>
        <div class="content">
          <el-input
            type="textarea"
            v-model="item.content"
            placeholder="请输入内容"
            :disabled="!isEditTable"
            :rows="16"
          >
          </el-input>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    allInfo: {
      type: Object,
      default: () => {
        return {};
      },
    },
    isEditTable: {
      type: Boolean,
      default: true,
    },
  },
  data() {
    return {
      items: [
        { name: "1", content: "" },
        { name: "2", content: "" },
        { name: "3", content: "" },
        { name: "4", content: "" },
      ],
    };
  },
  created() {},
  watch: {
    allInfo: {
      handler(val) {
        this.items = JSON.parse(JSON.stringify(val.items));
      },
      deep: true,
    },
  },
  methods: {
    formatter(val) {
      return this.$store.getters.fineDirtDataName("standard_rating_type", val);
    },
    getItemData() {
      let data = this.items.find((item) => {
        return item.content == "";
      });
      if (data) {
        this.$message.warning("评级标准不能为空");
        return false;
      } else {
        return this.items;
      }
    },
  },
};
</script>

<style lang="less" scoped>
.select {
  margin: 10px 0 20px 0px;
  display: flex;
  .item-label {
    font-size: 14px;
    padding: 0 16px 0 15px;
  }
  .item-label::before {
    content: "*";
    color: red;
    margin-right: 4px;
  }
  .list {
    width: calc(100% - 102px);
    display: flex;
    border: 1px solid #d7d7d7;
    .item {
      flex: 1;
      .title {
        height: 40px;
        line-height: 40px;
        font-weight: 600;
        font-size: 14px;
        background-color: #f2f2f2;
        border-right: 1px solid #d7d7d7;
      }
    }
  }
}
</style>